#region (c) 2014 Nguyễn, M. Hải - All rights reserved
/*
BLADE VIEW ENGINE

The MIT License (MIT)
Copyright (c) 2014 Nguyễn, M. Hải

Permission is hereby granted, free of charge, to any person obtaining a copy of this 
software and associated documentation files (the "Software"), to deal in the Software 
without restriction, including without limitation the rights to use, copy, modify, merge
, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
 substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
DEALINGS IN THE SOFTWARE.
*/
#endregion

#region Record of Change
//             							CHANGE HISTORY
// -------------------------------------------------------------------------------------
// |   DATE    | DEVELOPER  | DESCRIPTION                                              |
// -------------------------------------------------------------------------------------
// | 28-Apr-14 | HaiNM      | First creation.                                          |
// -------------------------------------------------------------------------------------
//
#endregion

#region Record of Audit
//             							REVIEW HISTORY
// -------------------------------------------------------------------------------------
// |   DATE    | REVIEWER   | NOTES                                                    |
// -------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------
//
#endregion

#region Using directives
using System;

using Thn;
using Thn.IO;
using Thn.Text;
using Thn.Collections;
#endregion

namespace Thn.Web.Blade
{
    /// <summary>
    /// 
    /// </summary>
#if DEBUG || TESTING
    public
#else
    internal
#endif
 class BladeParser : BladeParserBase
    {
        #region Fields
        #endregion

        #region Properties

        #endregion

        #region Events

        #region Found Text
        /// <summary>
        /// This event is raised after a text block is found.
        /// </summary>
        public event Action<string> FoundText;

        /// <summary>
        /// Invoke event FoundText.
        /// </summary>        
        protected void RaiseEventFoundText(string text)
        {
            Action<string> handler = FoundText;
            if (handler != null) handler(text);
        }
        #endregion

        #region Found Code Block
        /// <summary>
        /// This event is raised after a block of code is found.
        /// </summary>
        public event Action<string> FoundCodeBlock;

        /// <summary>
        /// Invoke event FoundCode.
        /// </summary>        
        protected void RaiseEventFoundCode(string code)
        {
            Action<string> handler = FoundCodeBlock;
            if (handler != null) handler(code);
        }
        #endregion

        #region Found Inline Code
        /// <summary>
        /// This event is raised after a section of inline code is found.
        /// </summary>
        public event Action<string> FoundInlineCode;

        /// <summary>
        /// Invoke event FoundInlineCode.
        /// </summary>        
        protected void RaiseEventFoundInlineCode(string code)
        {
            Action<string> handler = FoundInlineCode;
            if (handler != null) handler(code);
        }
        #endregion

        #endregion

        #region On Found Text
        /// <summary>
        /// This method is raised when a literal text is found.
        /// </summary>
        protected override void OnFoundText(string text)
        {
            RaiseEventFoundText(text);
        }
        #endregion

        #region On Found Inline Code
        /// <summary>
        /// This method is raised when a inline of code is found.
        /// </summary>
        protected override void OnFoundInlineCode(string text)
        {
            RaiseEventFoundInlineCode(text);
        }
        #endregion

        #region On Found Code Block
        /// <summary>
        /// This method is raised when a block of codes is found.
        /// </summary>
        protected override void OnFoundCodeBlock(string text)
        {
            RaiseEventFoundCode(text);
        }
        #endregion

        #region Constructors
        /// <summary>
        /// Create a new instance.
        /// </summary>
        public BladeParser()
            : base()
        { }
        #endregion
    }
}
